import React, { lazy, Suspense } from "react";
import { Route, Switch } from "react-router-dom";
// import '../router/Index'
//导入加载提示 loading 组件
import Loading from '../components/Loading';
const User=lazy(()=>import('../views/user'))
const Fails=lazy(()=>import('../views/fails'))
const Welcome=lazy(()=>import('../views/welcome'))


const Child = () => {
    return (
        // fallback后要以标签名的形式显示<Loading></Loading>
        <Suspense fallback={<Loading />}>
            {/* <Suspense> */}
            <Switch>
                {/* <Redirect from="/dashboard" to="/dashboard/welcome" exact /> */}
                <Route path="/dashboard/welcome" component={Welcome} />
                <Route path="/dashboard/user" component={User} />
                <Route path="/dashboard/cinema" component={Fails} />
            </Switch>
        </Suspense>
    );
}

export default Child;
